cat > /root/host_ip.txt << EOF
192.168.2.204
192.168.2.205
192.168.2.206
EOF
yum install -y expect
password='shqz8866.'
ssh-keygen -t rsa -b 2048 -N '' -f ~/.ssh/id_rsa

while read line;do                                  
expect << EOF


spawn ssh-copy-id $line
expect "(yes/no)?" {send "yes\r"}
expect "password:" {send "$password\r"}
expect "#" {send "exit\r"}
EOF
done <  /root/host_ip.txt
